#include "app.h"

CApp::CApp(){

}

CApp::~CApp(){
	if(m_Plan)
		delete 	m_Plan;
	if(m_TaskManager)
		delete m_TaskManager;
	if(m_DataStream)
		delete m_DataStream;
	if(m_DataDeal)
		delete m_DataDeal;
	if(m_Service)
		delete m_Service;
}

void CApp::initialize(){
	m_Plan = new CPlan;
	m_Plan->initialize();
	m_TaskManager = new CTaskManager;
	m_TaskManager->initialize();
	m_DataStream = new CDataStream;
	m_DataStream->initialize();
	m_DataDeal = new CDataDeal;
	m_Service = new CService;
}

void CApp::run(){
	start();
}

void CApp::execute(){
//	for(;;){
//
//Backuping:
//		if(m_Service->is_running()){
//			Sleep(10000);
//			continue;
//		}
//
//NoTask:
//		m_MainNode = m_MainNode.openFileHelper("task.sv", "SV");
//		int j = 0;
//		j = m_MainNode.nChildNode();
//		if(!j){
//			m_Plan->run();
//			if(!m_Plan->getState()){
//				Sleep(1000);
//				continue;
//			}
//			while(m_FileCheck->getExeState()){
//				Sleep(10000);
//			}
//			if(!m_FileCheck->getState()){
//				Sleep(10000);
//				continue;
//			}
//			if(m_FileCheck->getTask()){
//				continue;
//			}
//			Sleep(10000);
//		}
//Task:
//		XMLNode  child;
//		char * file;
//		child = m_MainNode.getChildNode(0);
//		file = (char *)(child.getText());
//		m_DataDeal.insert(file);
//
//		m_Service->initialize();
//		m_Service->run();
//
//		Sleep(10000);
//	}
}